package stu.wingsmaker.artofsubway.model.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class CultureDatabaseOpenHelper extends SQLiteOpenHelper {
	
	public final static String PLACETABLE = "CULTURE_PLACE";
	public final static String PLACENAME = "PLACE_NAME";
	public final static String IMGID = "PLACE_IMGID";
	public final static String SUBWAYSTATION = "SUBWAY_STATION";
	public CultureDatabaseOpenHelper(Context context, String name,
			CursorFactory factory, int version) {
		super(context, name, factory, version);
	
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		
		//db.execSQL("CREATE TABLE "+ PLACETABLE + "(_id INTEGER PRIMARY KEY AUTOINCREMENT,"+ PLACENAME +" TEXT, " + SUBWAYSTATION + " TEXT);");
		db.execSQL("CREATE TABLE CULTURE_PLACE (_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
										"PLACE_NAME TEXT, SUBWAY_STATION TEXT);");
		
	
		//db.execSQL("")
		
		db.execSQL("INSERT INTO "+ PLACETABLE +"(_id, "+ PLACENAME +", "
				+ SUBWAYSTATION +") values(null, '서울시립미술관', '시청역(2호선)');");
		
		db.execSQL("INSERT INTO "+ PLACETABLE +"(_id, "+ PLACENAME +", "
				+ SUBWAYSTATION +") values(null, '경복궁', '경복궁역(3호선)');");
		
		db.execSQL("INSERT INTO "+ PLACETABLE +"(_id, "+ PLACENAME +", "
				+ SUBWAYSTATION +") values(null, '서울역사박물관', '서대문역(5호선)');");
		
		db.execSQL("INSERT INTO "+ PLACETABLE +"(_id, "+ PLACENAME +", "
				+ SUBWAYSTATION +") values(null, '국립중앙박물관', '이촌역(4호선)');");

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL("DROP TABLE "+ PLACETABLE +";");
	}

}
